import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;

import java.util.List;


public class Main{
    public static void main(String[] args) {


        System.setProperty("webdriver.chrome.driver", "src/test/resources/chromedriver.exe");
        WebDriver driver = new ChromeDriver();
        driver.manage().window().maximize();
        driver.get("http://radost.ua");


        WebElement loginField;
        loginField = driver.findElement(By.id("name"));
        loginField.sendKeys("fotinn14@gmail.com");

        WebElement passwordField;
        passwordField = driver.findElement(By.id("password"));
        passwordField.sendKeys("ababagalamaga");
        driver.findElement(By.id("login-button")).click();

        driver.findElement(By.xpath("//*[@id='header']/div[1]/div/a[1]")).click();
        driver.findElement(By.xpath("//a[@href='/series/extreme']")).click();
        driver.findElement(By.xpath("//*[@id='content']/div/ul/li[1]")).click();
        driver.findElement(By.xpath("//a[@href='/store/add_to_cart/205']")).click();

        List<WebElement> products = driver.findElements(By.cssSelector(".name"));
        System.out.println("Number of products "+products.size() );
        if (products.size() != 1)
            System.out.println("Something went wrong...");
        else
            System.out.println("Well done!");

        driver.quit();

    }

}
